/**
 * 278.第一个错误的版本
 */
public class ErrorVersion {

    public static int findVersion(int n){
        int left=1;
        int right=n;
        while (left<right){
            int mid=(right-left)/2+left;
            if (isBadVersion(mid)) {
                right=mid;
            }else {
                left=mid+1;
            }
        }
        return left;
    }

    public static boolean isBadVersion(int n){
        return n>=1;
    }

    public static void main(String[] args) {
        System.out.println(findVersion(3));
    }


}
